package br.com.arndroid.coupman.view;

import greendroid.app.GDActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import br.com.arndroid.coupman.R;
import br.com.arndroid.coupman.site.SiteListActivity;

public class DashBoardActivity extends GDActivity {

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		// Set the layout:
		setActionBarContentView(R.layout.dashboard_layout);	        

		// Attach event handler to dash buttons:
		DashboardButtonListener listener = new DashboardButtonListener();
		findViewById(R.id.btnCoupons).setOnClickListener(listener);
		findViewById(R.id.btnSites).setOnClickListener(listener);
		findViewById(R.id.btnCategories).setOnClickListener(listener);
	}


	private class  DashboardButtonListener implements OnClickListener {
		@Override
		public void onClick(View v) {
			Intent i = null;
			switch (v.getId()) {
			case R.id.btnSites:
				i = new Intent(DashBoardActivity.this, SiteListActivity.class);
				break;
			// TODO: Change to thrown exception
			default:
				break;
			}
			if(i != null) {
				startActivity(i);
			}
		}
	}
}

